package test.netease.version3.chapter3.lesson_3_2_2;

import java.lang.management.ManagementFactory;
import java.lang.management.MemoryPoolMXBean;

/**
 * @author zhangrui
 * @date 2020-06-30 06:45
 * @since 1.0
 */

/**
 * 启动参数
 * -Xms2048m
 * -Xmx2048m
 * -Xmn1024m
 * -XX:+UseConcMarkSweepGC -- 使用标记-清除算法
 * -XX:+PrintFlagsFinal
 */
public class ShowGCTools {

    public static void main(String[] args) throws Exception {

        byte[] array = new byte[700 * 1024 * 1024];

        for (MemoryPoolMXBean memoryPoolMXBean : ManagementFactory.getMemoryPoolMXBeans()) {

            System.out.println(memoryPoolMXBean.getName() + "   total:" + memoryPoolMXBean.getUsage()
                    .getCommitted()
                    + "   used:" + memoryPoolMXBean.getUsage().getUsed());
        }

    }
}
